<admintpl file="header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:U('plugin/index')}">{:L('ADMIN_PLUGIN_INDEX')}</a></li>
			<li class="active"><a>{:L('ADMIN_PLUGIN_SETTING')}</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form" action="{:U('plugin/setting_post')}">
			<empty name="custom_config">
				<foreach name="data['config']" item="form">
					<div class="control-group">
						<label class="control-label" for="{$key}">
							{$form.title|default=''}
						</label>
						<switch name="form.type">
							<case value="text">
							<div class="controls">
								<input type="text" name="config[{$key}]" class="text input-large" value="{$form.value}" id="{$key}">
								<present name="form.tip">
									<span class="help-block">{$form.tip}</span>
								</present>
							</div>
							</case>
							<case value="password">
							<div class="controls">
								<input type="password" name="config[{$key}]" class="text input-large" value="{$form.value}" id="{$key}">
								<present name="form.tip">
									<span class="help-block">{$form.tip}</span>
								</present>
							</div>
							</case>
							<case value="hidden">
								<input type="hidden" name="config[{$key}]" value="{$form.value}">
							</case>
							<case value="radio">
							<div class="controls">
								<foreach name="form.options" item="opt" key="opt_k">
									<label class="radio inline">
										<php>$radio_checked=$opt_k==$form['value']?"checked":"";</php>
										<input type="radio" name="config[{$key}]" value="{$opt_k}" {$radio_checked}>{$opt}
									</label>
								</foreach>
								<present name="form.tip">
										<span class="help-block">{$form.tip}</span>
								</present>
							</div>
							</case>
							<case value="checkbox">
							<div class="controls">
								<foreach name="form.options" item="opt" key="opt_k">
									<label class="checkbox inline">
										<php>
											is_null($form["value"]) && $form["value"] = array();
										</php>
										<input type="checkbox" name="config[{$key}][]" value="{$opt_k}" <in name="opt_k" value="$form.value"> checked</in>>{$opt}
									</label>
								</foreach>
								<present name="form.tip">
									<span class="help-block">{$form.tip}</span>
								</present>
							</div>
							</case>
							<case value="select">
							<div class="controls">
								<select name="config[{$key}]" id="{$key}">
									<foreach name="form.options" item="opt" key="opt_k">
										<option value="{$opt_k}" <eq name="form.value" value="$opt_k"> selected</eq>>{$opt}</option>
									</foreach>
								</select>
								<present name="form.tip">
									<span class="help-block">{$form.tip}</span>
								</present>
							</div>
							</case>
							<case value="textarea">
							<div class="controls">
								<textarea name="config[{$key}]" id="{$key}">{$form.value}</textarea>
								<present name="form.tip">
									<span class="help-block">{$form.tip}</span>
								</present>
							</div>
							</case>
						</switch>
					</div>
				</foreach>
			<else />
				<present name="custom_config">
					{$custom_config}
				</present>
			</empty>
			<input type="hidden" name="id" value="{:I('id')}" readonly>
			<div class="form-actions">
	            <button type="submit" class="btn btn-primary js-ajax-submit">保存</button>
	            <a class="btn" href="{:U('plugin/index')}">返回</a>
	      	</div>
		</form>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
</body>
</html>